package com.wanxing.sellerapp.emqx.handlers

import com.alibaba.fastjson.JSONObject
import com.blankj.utilcode.util.ShellUtils
import com.wanxing.sellerapp.AppExecutors
import com.wanxing.sellerapp.emqx.entity.EmqPayload
import com.wanxing.sellerapp.emqx.interfaces.IMessenger
import com.wanxing.sellerapp.seller.SellerManager
import java.util.concurrent.TimeUnit

class RebootHandler(messenger: IMessenger, sellerManager: SellerManager)
    : AbstractActionHandler(messenger, sellerManager) {
    override fun handleAction(messageId: String?, data: JSONObject, payload: EmqPayload) {
        AppExecutors.diskIO.schedule({
            ShellUtils.execCmd("reboot", true, false)
        },1000, TimeUnit.MILLISECONDS)
    }

}